#!/bin/sh
#
# /etc/rc.d/rc.bluez-alsa
#

case "$1" in
  'start')
    nohup /usr/bin/bluealsa > /dev/null 2>&1 &
    echo $! > /var/run/bluealsa.pid 
  ;;
  'stop')
    kill $(cat /var/run/bluealsa.pid)
    rm -f /var/run/bluealsa.pid
  ;;
  'restart')
    kill $(cat /var/run/bluealsa.pid)
    nohup /usr/bin/bluealsa > /dev/null 2>&1 &
    echo $! > /var/run/bluealsa.pid
  ;;
  *)
    echo "Usage: $0 {start|stop|restart}"
  ;;
esac

